#include <stdio.h>
#include <assert.h>

// sostavlenie flagov
#define READONLY			(1 << 0)
#define ARCHIVE				(1 << 1)
#define EXECUTABLE			(1 << 2)

/********* zadanie

  1. Napisat is_bit_set - proveryaet ustanovlen li bit N v chisle X

***********/
bool is_bit_set(int n, int x)
{
	int mask = (1 << n);

	if( (x & mask) != 0 )
		return true;
	else
		return false;
}

bool is_bit_set2(int n, int x)
{
	return (x & (1 << n));
}

bool is_bit_set3(int n, int x)
{
	int mask = (1 << n);
/*
	bool y = x % 2 == 0 ? true : false;

	if (x % 2 == 0)
		y = true;
	else
		y = false;
*/

	return ( (x & mask) != 0 ? true : false )
}

void bar(int x)
{	
	if( x & (1 << 24) )
	{
		printf("25\n");
	}
	if( x & 1 )
	{
		printf("1\n");
	}
}

int main()
{
	char a = 0x15;
	char b = 0x95;
	char c = 0xAA;
	char attr = READONLY | ARCHIVE;

	assert( (a & 0x80) == 0 );
	assert( (b & 0x80) != 0 );
	assert( (a & 0x10) != 0 );
	assert( (b & 0x10) != 0 );
	assert( (c & 0x20) != 0 );
	assert( (c & 0x40) == 0 );
	assert( is_bit_set(0x80000000, 31) );
	bar((1 << 24) | 1);

	MessageBox( HWND_DESKTOP, "adas", "asfdvcx", MB_OKCANCEL | MB_ICONWARNING );

	return 0;
}
